package com.yuyou.tas.admin.api;

import com.yuyou.tas.admin.service.IAuthUserSectionService;
import com.yuyou.tas.admin.service.IAuthUserService;
import com.yuyou.tas.admin.service.IAuthUserSubjectService;
import com.yuyou.tas.service.api.admin.dto.AuthUserSubjectDTO;
import com.yuyou.tas.service.api.admin.dto.SycnUserUpdateObj;
import com.yuyou.tas.service.api.admin.entity.AuthUser;
import com.yuyou.tas.service.api.admin.entity.AuthUserSection;
import com.yuyou.tas.service.api.admin.service.AuthUserAPI;
import com.yuyou.tas.util.bean.ResBoolSimpleInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

@RestController
public class AuthUserAPIImpl implements AuthUserAPI{

	@Autowired
	private IAuthUserService authUserService;
	
	@Autowired
	private IAuthUserSubjectService authUserSubjectService;
	
	@Autowired
	private IAuthUserSectionService authUserSectionService;
	
	@Override
	public AuthUser selectById(@RequestParam("id") Long id) {
		return authUserService.selectByPrimaryKey(id);
	}

	@Override
	public ResBoolSimpleInfo<String> sycnUserByOId(@RequestBody List<SycnUserUpdateObj> list){
		return authUserService.sycnUserByOId(list);
	}

	@Override
	public AuthUser selectByOrgan7OId(@RequestParam("oId")Long oId, @RequestParam("authOrganizationId")Long authOrganizationId) {
		return authUserService.selectByOrgan7OId(oId, authOrganizationId);
	}

	@Override
	public List<AuthUserSubjectDTO> findSubjectByAuthUserId(@RequestParam("userId")Long userId) {
		return authUserSubjectService.findSubjectByAuthUserId(userId);
	}

	@Override
	public Set<Long> findUniSectionByUserId(@RequestParam("userId")Long userId) {
		return authUserSectionService.findUniSectionByUserId(userId);
	}

	@Override
	public AuthUserSection findSectionByUserIdSubjectId(Long authUserId, Long dataSubject) {
		return authUserSectionService.findSectionByUserIdSubjectId(authUserId , dataSubject);
	}

	@Override
	public Integer findCountByParams(Long authUserId, Long dataSubject, Long sectionId) {
		return authUserSectionService.findCountByParams(authUserId , dataSubject , sectionId);
	}


}
